<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>javascript</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box
    }
    body {
      font-size: 14px;
      padding: 20px;
    }
    ul li {
      line-height: 30px;
    }
    #div {
      width: 200px;
      height: 200px;
    }
  </style>
</head>
<body>
  <ul>
    <li class="liList">点击事件</li>
    <li onclick="handleClick(event,this)">点击事件</li>
    <li onclick="getDate1()">jsonp</li>
    <input type="text" onkeydown="show(event)">
    <div id="div"></div>
  </ul>
</body>
<script>
  var url = 'http://pic32.nipic.com/20130823/13339320_183302468194_2.jpg'
  document.addEventListener('DOMContentLoaded', function() {
  }, false)
  window.onmousewheel = function(event) {
    document.querySelector("#div").style.marginTop = event.wheelDeltaY + 'px'
    console.log(event.wheelDeltaX, event.wheelDeltaY)
  }
  window.onload = function() {
    var img = new Image()
    img.src = url
    document.querySelector("#div").style.backgroundColor = 'red'
    img.onload = function() {
      document.querySelector("#div").style.background = 'url('+url+')'
    }
  }
  function show(event) {
    event.preventDefault()
    event.stopPropagation()
    console.log(event)
  }
  document.querySelector('.liList').addEventListener('click', (e) => {
    console.log(e)
  }, false)
  function handleClick(event,e) {
    console.log(event, e)
  }
  function getJson(data) {
    console.log(data);
  }
  function getDate() {
    let sc = document.createElement('script');
    sc.type="text/javascript";
    sc.src = "http://xiaoyueyue.com.cn:8089/getData?callback=getJson";
    document.getElementsByTagName("head")[0].appendChild(sc);
  }
  function getDate1() {
    var XMLHttp = new XMLHttpRequest();
    XMLHttp.open('get', 'http://xiaoyueyue.com.cn:8089/getData?callback=getJson');
    XMLHttp.send(null);
    XMLHttp.onreadystatechange = function() {
      if (XMLHttp.readyState === 4) {
        if (XMLHttp.status === 200) {
          console.log(XMLHttp.responseText)
        }
      }
    }
  }
  console.log(b)
  var b = 1
  new Promise(function(resolve, reject){
    console.info(2)
    resolve()
  }).then(function() {
    console.log(3)
  }) 
  setTimeout(function() {
    console.log(4)
  },0)
  function fun () {
    setTimeout(() => {
      console.log(this.b)
    })
  }
  fun()
  var obj = {
    title: 'haha',
    getTitle: function() {
      console.log(this.title, 1)
    }
  }
  obj.getTitle.call(window)
</script>
</html>